# Contributor: Coco Liliace <coco@liliace.dev>
# Maintainer: Coco Liliace <coco@liliace.dev>
pkgname=heisenbridge
pkgver=1.14.6
pkgrel=0
pkgdesc="Bouncer-style Matrix IRC bridge"
url="https://github.com/hifi/heisenbridge"
arch="noarch"
license="MIT"
depends="
	python3
	py3-irc
	py3-ruamel.yaml.clib
	py3-mautrix
	py3-python-socks
	py3-aiohttp
	"
makedepends="py3-gpep517 py3-setuptools py3-wheel"
checkdepends="py3-pytest"
subpackages="$pkgname-pyc"
source="$pkgname-$pkgver.tar.gz::https://github.com/hifi/heisenbridge/archive/refs/tags/v$pkgver.tar.gz"

_distname=".dist"

prepare() {
	default_prepare

	echo "$pkgver" > heisenbridge/version.txt
}

build() {
	gpep517 build-wheel --output-fd 3 --wheel-dir "$_distname" 3>&1 >&2
}

check() {
	python3 -m venv --clear --without-pip --system-site-packages .testenv
	.testenv/bin/python3 -m installer "$_distname"/*.whl
	.testenv/bin/python3 -m pytest
}

package() {
	gpep517 install-wheel --destdir "$pkgdir" "$_distname"/*.whl
}

sha512sums="
6e89679f87b4774c035981360b155590c0bd238e575be5673a447a4b348d85ef9f4c7557d6ebaed27a2e6f7823322a0641959f252e8e3c33559e5b68ccf6f252  heisenbridge-1.14.6.tar.gz
"
